/*
ID: guoxu1
PROG: packrec
LANG: C++
*/
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

#define cin fin
#define cout fout

struct Rectangle
{
  int h;
  int w;

  Rectangle()
  {
    h = 0;
    w = 0;
  }

  void rotate()
  {
    std::swap( w, h );
  }

  void standup()
  {
    if( w > h ) std::swap( w, h );
  }

  bool operator< ( const Rectangle& r ) const
  {
    if( w == r.w ) return h < r.h;
    return w < r.w;
  }

  bool operator== ( const Rectangle& r ) const
  {
    return ( h == r.h ) && ( w == r.w );
  }
};
typedef vector<Rectangle> RectGroup;



void check1( const RectGroup& g, Rectangle& box )
{
  box.w = g[0].w + g[1].w + g[2].w + g[3].w;
  box.h = max( g[0].h, max( g[1].h, max( g[2].h, g[3].h ) ) );
}

void check2( const RectGroup& g, Rectangle& box )
{
  box.w = max( g[0].w + g[1].w + g[2].w, g[3].w );
  box.h = max( g[0].h, max( g[1].h, g[2].h ) ) + g[3].h;
}

void check3( const RectGroup& g, Rectangle& box )
{
  box.w = max( g[0].w + g[1].w, g[2].w ) + g[3].w;
  box.h = max( max( g[0].h, g[1].h ) + g[2].h, g[3].h );
}

void check4( const RectGroup& g, Rectangle& box )
{
  box.w = g[0].w + max( g[1].w, g[2].w ) + g[3].w;
  box.h = max( g[0].h, max( g[1].h + g[2].h, g[3].h ) );
}

void check5( const RectGroup& g, Rectangle& box )
{
  box.w = max( g[0].w ,g[1].w ) + g[2].w + g[3].w;
  box.h = max( g[0].h + g[1].h, max( g[2].h, g[3].h ) );
}

void check6( const RectGroup& g, Rectangle& box )
{
  box.w = max( g[0].w + g[3].w, g[1].w + g[2].w );
  box.h = max( g[0].h + g[1].h, g[2].h + g[3].h );
  if( box.h < g[0].h + g[2].h ) box.w = max( box.w, g[0].w + g[2].w );
  if( box.h < g[1].h + g[3].h ) box.w = max( box.w, g[1].w + g[3].w );
  if( box.w < g[0].w + g[2].w ) box.h = max( box.h, g[0].h + g[2].h );
  if( box.w < g[1].w + g[3].w ) box.h = max( box.h, g[1].h + g[3].h );  
}

typedef void (*checkptr)( const RectGroup& g, Rectangle& box );

int main()
{
  checkptr checks[6] = { check1, check2, check3, check4, check5, check6 };
  ifstream fin( "packrec.in" );
  ofstream fout( "packrec.out" );

  RectGroup o(4);
  for( int i = 0; i < 4; i++ )
  {
    cin >> o[i].w >> o[i].h;
  }

  RectGroup minBoxs(1);
  minBoxs[0].w = minBoxs[0].h = 1000;

  for( int k = 0; k < 16; k++ )
  {
    RectGroup t = o;
    for( int i = 0; i < 4; i++ )
    {
      if( (k >> i) & 0x01 )
      {
        t[i].rotate();
      }
    }

    std::sort( t.begin(), t.end() );
    do
    {
      for( int i = 0; i < 6; i++ )
      {
        Rectangle box;
        checks[i]( t, box );
        box.standup();
        if( minBoxs.empty() || minBoxs[0].h * minBoxs[0].w == box.h * box.w )
        {
          minBoxs.push_back( box );
        }
        else if( minBoxs[0].h * minBoxs[0].w > box.h * box.w )
        {
          minBoxs.clear();
          minBoxs.push_back( box );
        }
      }
    }while( next_permutation( t.begin(), t.end() ) );
  }

  std::sort( minBoxs.begin(), minBoxs.end() );
  RectGroup::iterator new_end = std::unique( minBoxs.begin(), minBoxs.end() );
  minBoxs.erase( new_end, minBoxs.end() );
  cout << minBoxs[0].w * minBoxs[0].h << endl;
  for( size_t i = 0; i < minBoxs.size(); i++ )
  {
    cout << minBoxs[i].w << " " << minBoxs[i].h << endl;
  }
  
  return 0;
}

